package db

import (
	"fmt"
	"os"

	"github.com/jinzhu/gorm"
	_ "github.com/jinzhu/gorm/dialects/sqlite"
)

var db *gorm.DB

func init() {
	var err error
	db, err = gorm.Open("sqlite3", "gorm.db")
	if err != nil {
		fmt.Println("da connect error.")
		os.Exit(1)
	}
}

func Connect() *gorm.DB {
	return db
}
